/**
 * @Author       : Hejh(3010733382@qq.com)
 * @Version      : V1.0
 * @Date         : 2024-01-17 10:58:33
 * @Description  : 通知修改接口路由
 */
const Router = require('koa-router')
const { verifyToken } = require('@/utils/jwt')
const noticeValidate = require('@/middlewares/validateMiddlewares/noticeValidate')
const { verifyAuth } = require('@/middlewares/authMiddlewares/verifyAuth')
const noticeController = require('@/controller/noticeController')

const router = new Router()

/**
 * 获取通知列表
 */
router.get(
  '/list',
  verifyToken(),
  // verifyAuth(['admin.index.setting']),
  noticeValidate.listNoticeValidate,
  noticeController.listNotice
)

/**
 * 用户获取通知列表
 */
router.get('/user/list', verifyToken(), noticeController.listUserNotice)

/**
 * 用户已读通知接口
 */

router.post(
  '/read',
  verifyToken(),
  noticeValidate.readNoticeValidate,
  noticeController.readNotice
)

/**
 * 创建通知列表
 */
router.post(
  '/create',
  verifyToken(),
  verifyAuth(['admin.index.setting']),
  noticeValidate.createNoticeValidate,
  noticeController.createNotice
)

/**
 * 更新通知列表
 */
router.put(
  '/update',
  verifyToken(),
  verifyAuth(['admin.index.setting']),
  noticeValidate.updateNoticeValidate,
  noticeController.updateNotice
)

/**
 * 删除通知列表
 */
router.delete(
  '/delete',
  verifyToken(),
  verifyAuth(['admin.index.setting']),
  noticeValidate.delNoticesValidate,
  noticeController.delNotices
)

/**
 * 通知排序
 */
router.put(
  '/sort',
  verifyToken(),
  verifyAuth(['admin.index.setting']),
  noticeValidate.sortNoticesValidate,
  noticeController.sortNotices
)

module.exports = router
